//
//  VoiceView.m
//  RainbowFM
//
//  Created by Kratos on 15/1/5.
//  Copyright (c) 2015年 RB. All rights reserved.
//

#import "VoiceView.h"

@implementation VoiceView

-(void)setTime:(CGFloat)second
{
   [_voiceTime setText:_F(@"%f'",second)];
}

-(void)setImagesByDirection:(NSInteger)direction
{
    [_voiceImages setImage:[UIImage imageNamed:_F(@"voice_%@_2.png",direction == 0 ? @"l": @"r")]];
    
    _voiceImages.backgroundColor = [UIColor clearColor];
    _voiceImages.animationDuration = 1.0;
    _voiceImages.animationRepeatCount = HUGE_VALF;
    
    NSMutableArray *images = [NSMutableArray array];
    for (int i = 0; i < 3; i++) {
        UIImage *image = [UIImage imageNamed:_F(@"voice_%@_%d.png",direction == 0 ? @"l": @"r",i)];
        [images addObject:image];
    }
    
    _voiceImages.animationImages = images;
}
-(void)start
{
    [self stop];
    [_voiceImages startAnimating];
}

-(void)stop
{
    if ([_voiceImages isAnimating]) {
        [_voiceImages stopAnimating];
    }
    
}


@end
